import { exec } from 'child_process';

const DOC_SOURCE = 'src/pages/components/doc/doc.scss';
const DOC_TARGET = 'src/static/doc.scss';

export function isDocFile(file) {
    return file.includes(DOC_SOURCE);
}

export function compileDocStyle(env) {
    let command = `npx sass --load-path=node_modules --load-path=src --no-source-map ${DOC_SOURCE} ${DOC_TARGET.replace(
        'scss',
        'css'
    )}`;
    if (env === 'live') {
        exec(command + ' --style compressed');
    }
    exec(command);
}
